<!--
	作者：956911785@qq.com
	时间：2019年11月13日20:25:20
	描述：诗词语音管理搜索
-->
<template>
    <div style="width:100%;"> 
        <Tetable ref="tdtable" height="450" :columns="columns9" type="post" :paramiters="tj" :serverUrl="serverUrl"></Tetable>
        <edit ref="edit" v-on:reload="load()" :editparam="editparam"></edit>
    </div> 
</template>
<script>
	import EditDelLook from "./EditDelLook";
	import edit from "./edit";
    export default {
    	name: "scyyss",
    	props: {
    		tj:{
    			type: Object
    		},	
    	},
        data () {
            return {
            	serverUrl:"/host/readbook/scyy/Search_scyy.html",
                columns9: [
                    {
                        type: 'index',
                        width: 60,
                        title: '序号',
                        align: 'center'
                    },{
                        title: '语音名称',
                        key: 'PNAME',
                        align: 'center',
                    },{
                        title: '作者姓名',
                        key: 'AUTHOR',
                        align: 'center', 
                    },{
                        title: '任务年级',
                        key: 'NJ',
                        align: 'center', 
                    }, {
                        title: '任务班级',
                        key: 'BJ',
                        align: 'center', 
                    }, {
                        title: '发布人',
                        key: 'NAME',
                        align: 'center', 
                    },{
                        title: '发布时间',
                        key: 'PUBILSHTIME',
                        align: 'center', 
                    }, {
                        title: '状态',
                        key: 'BSTATET',
                        align: 'center',  
						render: (h, params) => {
							return h("a",{
						    	on:{ 
						    		click: () => {
										if(params.row.BSTATE==0){
											this.$Modal.confirm({
											    title: '提示',
											    content: '是否发布，如果发布请点击确认',
											    onOk: () => {
													this.readid=params.row.READID;
													this.update_scyy_bstate();
											    }
											});
										}
						    		}
						    	} 
							},params.row.BSTATET)
						}
                    },{
                        title: '操作',
                        key: 'action',
                        width: 200,
                        align: 'center',
                        render: (h, params) => {
                            return h(EditDelLook, {
                            	on: {
                                    //修改诗词语音
                                    edit: () => {
                                    	const rows=params.row;
                                    	var readid="";
                                    	if(rows.READID){
                                    		readid=rows.READID;
                                    	}
										
                                    	var pname="";
                                    	if(rows.PNAME){
                                    		pname=rows.PNAME;
                                    	}
										
										var author="";
										if(rows.AUTHOR){
											author=rows.AUTHOR;
										}
										
										var nj="";
										if(rows.NJ){
											nj=rows.NJ+"";
										}
										
										var bj="";
										if(rows.BJ){
											bj=rows.BJ+"";
										}
										
										var pcontent="";
										if(rows.PCONTENT){
											pcontent=rows.PCONTENT;
										}
										
										var fm="";
										if(rows.FM){
											fm=rows.FM;
										}

										var bstate="";
										if(rows.BSTATE){
											bstate=rows.BSTATE+"";
										}
										
										var listsc=[];
										if(rows.listsc){
											listsc=rows.listsc;
										}
										
										var listyy=[];
										if(rows.listyy){
											listyy=rows.listyy;
										}
										
                                    	this.editparam={
											readid:readid, 
											pname:pname, 
											author:author, 
											nj:nj, 
											bj:bj, 
											pcontent:pcontent, 
											fm:fm,
											bstate:bstate,
											listsc:listsc,
											listyy:listyy
                                    	}
										
                                        this.$refs.edit.openmodal();
                                    },
                                    //删除诗词语音
                                    remove: () =>{
										const rows=params.row;
										this.remove(rows.READID)
                                    }, 
                                }
                            });
                        }
                    }
                ],
                editparam:{},
                readid:'',
				
            }
        },
        computed: {	
			
		},
		methods: {
			//删除书籍
			remove:function(readid){
                this.$Modal.confirm({
                    title: '警告',
                    content: '请确定是否删除！！！',
                    onOk: () => {
                    	//执行删除代码
                    	this.$http.get("/host/readbook/scyy/del_scyyByid.html?readid="+readid)
						.then(datas => {
							if(datas.result){
								//删除成功 刷新页面
								this.$Message.info('删除成功');
								this.$refs.tdtable.load();
							}else{
								//删除失败
								this.$Message.info(datas.msg);
							}
							
						});
                    }
                });
			},
			
			
			load(){
				this.$refs.tdtable.load();
			},

			//修改诗词语音状态
			update_scyy_bstate(){
				var readid=this.readid;
				const params={
					bstate:"1",
					readid:readid
				};
				this.$http.post("/host/readbook/scyy/update_scyy_bstate.html",params)
				.then(datas => {
					if(datas.result){
						//提交成功 刷新页面
						this.$Message.info('提交成功');
						this.$refs.tdtable.load();
					}else{
						//提交失败
						this.$Message.info(datas.msg);
					}
				});
			},
			
	    },
		mounted() {
		},
		watch:{
		},
		components: {
			EditDelLook,
			edit
		}
    }
</script>


<style scoped="scoped">
	
	.ivu-table-wrapper {
		border:none;
	}
	
	.toolstipdiv{
		width: '100%';
		overflow: 'hidden';
		textOverflow: 'ellipsis';
		whiteSpace: 'normal';
		wordBreak: 'break-all';
		color:'#fff';
		text-align: center;
	}
	.toolstipdiv:hover{
		background:rgb(63, 193, 201);
	}
	
	.ivu-tooltip-rel label:hover{
		color:#0023FB;
	}
	
	.tablediv{
		height: '40px';
		overflow:'hidden';
		line-height: '40px';
	}
</style>



